package com.aaa.mrcai.controller;

import com.aaa.mrcai.pojo.vo.GoodsVO;
import com.aaa.mrcai.pojo.vo.StoreGoodsVO;
import com.aaa.mrcai.query.AddStoreGoodsQuert;
import com.aaa.mrcai.query.StoreGoodsQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.StoreGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author 惠普
 * @date 2021/12/9  20:33
 */
@RestController
@RequestMapping("storeGoods")
public class StoreGoodsController {

    @Autowired
    private StoreGoodsService storeGoodsService;

    @RequestMapping("searchList")
    public AjaxResult list(StoreGoodsQuery storeGoodsQuery){
        return storeGoodsService.searchList(storeGoodsQuery);
    }

    @RequestMapping("putdate")
    public AjaxResult putdate(StoreGoodsQuery storeGoodsQuery){
        return storeGoodsService.putdate(storeGoodsQuery);
    }

    @RequestMapping("/getOneGoods/{id}")
    public AjaxResult getOneGoods(@PathVariable int id){
        return storeGoodsService.getOneGoods(id);
    }

    @RequestMapping("stateList")
    public AjaxResult stateList(){
        return storeGoodsService.stateList();
    }

    @RequestMapping("updateOneGoods")
    public AjaxResult updateOneGoods(StoreGoodsVO storeGoodsVO){
        return storeGoodsService.updateOneGoods(storeGoodsVO);
    }

    @RequestMapping("getCid")
    public AjaxResult getCid(StoreGoodsQuery storeGoodsQuery){
        return storeGoodsService.getCid(storeGoodsQuery);
    }

    @RequestMapping("addGoodsList")
    public AjaxResult addGoodsList(AddStoreGoodsQuert addStoreGoodsQuert){
        return storeGoodsService.addGoodsList(addStoreGoodsQuert);
    }

    @RequestMapping("addOneGoods")
    public AjaxResult addOneGoods(GoodsVO goodsVO){
        return storeGoodsService.addOneGoods(goodsVO);
    }

    @RequestMapping("/deleteOneGoods/{id}")
    public AjaxResult deleteOneGoods(@PathVariable("id") int id){
        return storeGoodsService.deleteOneGoods(id);
    }

    @RequestMapping("/getState/{bid}")
    public AjaxResult getState(@PathVariable("bid") int bid){
        return storeGoodsService.getState(bid);
    }
}
